#!/bin/bash

[ ! -d "/tmp/extension" ] &&  mkdir /tmp/extension

pushd /tmp/extension

curl -Lk https://github.com/swoole/swoole-src/archive/v4.8.5.tar.gz | gunzip | tar x 

cd swoole-src-4.8.5
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

echo 'extension=swoole.so' > /usr/local/php/etc/php.d/03-swoole.ini

popd